<?xml version="1.0"?>

<!-- This Source Code Form is subject to the terms of the Mozilla Public
     License, v. 2.0. If a copy of the MPL was not distributed with this
     file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % advancedDTD SYSTEM "chrome://browser/locale/preferences/advanced.dtd">
%advancedDTD;
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
%privacyDTD;
]>

<overlay id="AdvancedPaneOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <prefpane id="paneAdvanced" onpaneload="gAdvancedPane.init();">

    <preferences id="advancedPreferences">
      <preference id="browser.preferences.advanced.selectedTabIndex"
                  name="browser.preferences.advanced.selectedTabIndex"
                  type="int"/>

      <!--XXX button prefs -->

      <!-- General tab -->
      <preference id="accessibility.typeaheadfind"     name="accessibility.typeaheadfind"     type="bool"/>

      <preference id="general.autoScroll"              name="general.autoScroll"              type="bool"/>
      <preference id="general.smoothScroll"            name="general.smoothScroll"            type="bool"/>
      <preference id="layers.acceleration.enabled"     name="layers.acceleration.enabled"     type="bool"
                  onchange="gAdvancedPane.updateHardwareAcceleration()"/>
      <preference id="layers.acceleration.force"       name="layers.acceleration.force"       type="bool"/>
#ifdef XP_WIN
      <preference id="gfx.direct2d.enabled"            name="gfx.direct2d.disabled"           type="bool"   inverted="true"/>
#endif
      <preference id="layout.spellcheckDefault"        name="layout.spellcheckDefault"        type="int"/>

#ifdef HAVE_SHELL_SERVICE
      <preference id="browser.shell.checkDefaultBrowser"
                  name="browser.shell.checkDefaultBrowser"
                  type="bool"/>

      <preference id="pref.general.disable_button.default_browser"
                  name="pref.general.disable_button.default_browser"
                  type="bool"/>
#endif
      <preference id="pref.general.compatmode" name="general.useragent.compatMode"        type="int"/>
      
      <preference id="pref.general.captiveportal" name="network.captive-portal-service.enabled" type="bool"/>

      <!-- Network tab -->
      <preference id="browser.cache.disk.capacity"     name="browser.cache.disk.capacity"     type="int"/>

      <preference id="browser.cache.disk.smart_size.enabled"
                  name="browser.cache.disk.smart_size.enabled"
                  inverted="true"
                  type="bool"/>

      <preference id="offline-apps.permissions"        name="offline-apps.permissions"        type="int"
                  onchange="gAdvancedPane.updateOfflineAppsPermissions()"/>
      <preference id="browser.offline-apps.notify"     name="browser.offline-apps.notify"     type="bool"/>
      <preference id="offline-apps.allow_by_default"   name="offline-apps.allow_by_default"   type="bool"/>

     <!-- Update tab -->
#ifdef MOZ_UPDATER
      <preference id="app.update.enabled"              name="app.update.enabled"              type="bool"/>
      <preference id="app.update.auto"                 name="app.update.auto"                 type="bool"/>
      <preference id="app.update.mode"                 name="app.update.mode"                 type="int"/>

      <preference id="app.update.disable_button.showUpdateHistory"
                  name="app.update.disable_button.showUpdateHistory"
                  type="bool"/>
#endif

      <preference id="browser.search.update"           name="browser.search.update"           type="bool"/>

      <!-- Certificates tab -->
      <preference id="security.default_personal_cert"  name="security.default_personal_cert"  type="string"/>

      <preference id="security.disable_button.openCertManager"
                  name="security.disable_button.openCertManager"
                  type="bool"/>
      <preference id="security.disable_button.openDeviceManager"
                  name="security.disable_button.openDeviceManager"
                  type="bool"/>
      <preference id="security.OCSP.enabled"
                  name="security.OCSP.enabled"
                  type="int"/>
      <preference id="security.OCSP.require"
                  name="security.OCSP.require"
                  type="bool"/>

      <!-- Pale Moon: smooth scrolling tab -->
      <preference id="general.smoothScroll.lines"                    name="general.smoothScroll.lines"                    type="bool"/>
      <preference id="general.smoothScroll.lines.durationMinMS"      name="general.smoothScroll.lines.durationMinMS"      type="int"/>
      <preference id="general.smoothScroll.lines.durationMaxMS"      name="general.smoothScroll.lines.durationMaxMS"      type="int"/>
      <preference id="general.smoothScroll.pages"                    name="general.smoothScroll.pages"                    type="bool"/>
      <preference id="general.smoothScroll.pages.durationMinMS"      name="general.smoothScroll.pages.durationMinMS"      type="int"/>
      <preference id="general.smoothScroll.pages.durationMaxMS"      name="general.smoothScroll.pages.durationMaxMS"      type="int"/>
      <preference id="general.smoothScroll.mouseWheel"               name="general.smoothScroll.mouseWheel"                   type="bool"/>
      <preference id="general.smoothScroll.mouseWheel.durationMinMS" name="general.smoothScroll.mouseWheel.durationMinMS"     type="int"/>
      <preference id="general.smoothScroll.mouseWheel.durationMaxMS" name="general.smoothScroll.mouseWheel.durationMaxMS"     type="int"/>
      <preference id="general.smoothScroll.scrollbars"               name="general.smoothScroll.scrollbars"               type="bool"/>
      <preference id="general.smoothScroll.scrollbars.durationMinMS" name="general.smoothScroll.scrollbars.durationMinMS" type="int"/>
      <preference id="general.smoothScroll.scrollbars.durationMaxMS" name="general.smoothScroll.scrollbars.durationMaxMS" type="int"/>
      
      <preference id="mousewheel.default.delta_multiplier_y"         name="mousewheel.default.delta_multiplier_y"         type="int"/>
    </preferences>

#ifdef HAVE_SHELL_SERVICE
    <stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
    <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif
    <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>

    <script type="application/javascript" src="chrome://browser/content/preferences/advanced.js"/>

    <tabbox id="advancedPrefs" flex="1"
            onselect="gAdvancedPane.tabSelectionChanged();">

      <tabs id="tabsElement">
        <tab id="generalTab" label="&generalTab.label;" helpTopic="prefs-advanced-general"/>
        <tab id="networkTab" label="&networkTab.label;" helpTopic="prefs-advanced-network"/>
        <tab id="updateTab" label="&updateTab.label;"  helpTopic="prefs-advanced-update"/>
        <tab id="encryptionTab" label="&certificateTab.label;" helpTopic="prefs-advanced-encryption"/>
        <tab id="scrollparamTab" label="&scrollparamTab.label;" helpTopic="prefs-advanced-scrollparams"/>      
      </tabs>

      <tabpanels flex="1">

        <!-- General -->
        <tabpanel id="generalPanel" orient="vertical">

          <!-- Accessibility -->
          <groupbox id="accessibilityGroup" align="start">
            <caption label="&accessibility.label;"/>

            <checkbox id="searchStartTyping"
                      label="&searchStartTyping.label;"
                      accesskey="&searchStartTyping.accesskey;"
                      preference="accessibility.typeaheadfind"/>
          </groupbox>

          <!-- Browsing -->
          <groupbox id="browsingGroup" align="start">
            <caption label="&browsing.label;"/>

            <checkbox id="useAutoScroll"
                      label="&useAutoScroll.label;"
                      accesskey="&useAutoScroll.accesskey;"
                      preference="general.autoScroll"/>
            <checkbox id="checkSpelling"
                      label="&checkSpelling.label;"
                      accesskey="&checkSpelling.accesskey;"
                      onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
                      onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
                      preference="layout.spellcheckDefault"/>
          </groupbox>

          <!-- Hardware Acceleration -->
          <groupbox id="browsingGroup" align="start">
            <caption label="&HWAccel.label;"/>
            <label>&restartRequired.label;</label>
            <checkbox id="allowHWAccel"
                      label="&allowHWAccel.label;"
                      accesskey="&allowHWAccel.accesskey;"
                      preference="layers.acceleration.enabled"/>
#ifdef XP_LINUX
            <checkbox id="forceHWAccel" class="indent"
                      label="&forceHWAccel.label;"
                      preference="layers.acceleration.force"/>
#endif
          </groupbox>

#ifdef HAVE_SHELL_SERVICE
          <!-- System Defaults -->
          <groupbox id="systemDefaultsGroup" orient="vertical">
            <caption label="&systemDefaults.label;"/>

            <checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
                      label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
                      flex="1"/>
            <hbox class="indent">
              <deck id="setDefaultPane">
                <button id="setDefaultButton"
                        label="&setDefault.label;" accesskey="&setDefault.accesskey;"
                        oncommand="gAdvancedPane.setDefaultBrowser();"
                        preference="pref.general.disable_button.default_browser"/>
                <description>&isDefault.label;</description>
              </deck>
            </hbox>
          </groupbox>
#endif
          <!-- User Agent compatibility -->
          <hbox id="GUAOwarning" align="center" hidden="true">
            <label style="color:red;" id="UAWarning">&UAWarning.label;</label>
            <button label="&UAWarning.reset;" oncommand="gAdvancedPane.GUAOReset();" />
          </hbox>
          <groupbox id="UACompatGroup" orient="vertical">
            <caption label="&UACompatGroup.label;"/>
            <hbox align="center">
              	<label id="UACompat" control="UACompat-menu">&UACompat.label;</label>
                <menulist id="UACompat-menu" preference="pref.general.compatmode" sizetopopup="always">
                    <menupopup>
                        <menuitem label="&UACompat.Native;"  value="0" />
                        <menuitem label="&UACompat.Gecko;"   value="1" />
                        <menuitem label="&UACompat.Firefox;" value="2" />
                    </menupopup>
                </menulist>
            </hbox>
          </groupbox>
          
          <!-- Captive portal detection -->
          <groupbox id="captivePortalGroup" orient="vertical">
            <caption label="&captivePortalGroup.label;"/>
            <checkbox id="captivePortalDetect"
                      label="&captivePortalDetect.label;"
                      preference="pref.general.captiveportal"/>
          </groupbox>
          
        </tabpanel>

        <!-- Network -->
        <tabpanel id="networkPanel" orient="vertical">

          <!-- Connection -->
          <groupbox id="connectionGroup">
            <caption label="&connection.label;"/>

            <hbox align="center">
              <description flex="1" control="connectionSettings">&connectionDesc.label;</description>
              <button id="connectionSettings" icon="network" label="&connectionSettings.label;"
                      accesskey="&connectionSettings.accesskey;"
                      oncommand="gAdvancedPane.showConnections();"/>
            </hbox>
          </groupbox>

          <!-- Cache -->
          <groupbox id="cacheGroup">
            <caption label="&httpCache.label;"/>

            <hbox align="center">
              <label id="actualDiskCacheSize" flex="1"/>
              <button id="clearCacheButton" icon="clear"
                      label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
                      oncommand="gAdvancedPane.clearCache();"/>
            </hbox>
            <checkbox preference="browser.cache.disk.smart_size.enabled"
                      id="allowSmartSize" flex="1"
                      onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
                      label="&overrideSmartCacheSize.label;"
                      accesskey="&overrideSmartCacheSize.accesskey;"/>
            <hbox align="center" class="indent">
              <label id="useCacheBefore" control="cacheSize"
                     accesskey="&limitCacheSizeBefore.accesskey;"
                     value="&limitCacheSizeBefore.label;"/>
              <textbox id="cacheSize" type="number" size="4" max="1024"
                       preference="browser.cache.disk.capacity"
                       onsyncfrompreference="return gAdvancedPane.readCacheSize();"
                       onsynctopreference="return gAdvancedPane.writeCacheSize();"
                       aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
              <label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
            </hbox>
          </groupbox>

          <!-- Offline apps -->
          <groupbox id="offlineGroup">
            <caption label="&offlineStorage2.label;"/>

            <hbox align="center">
              <label id="actualAppCacheSize" flex="1"/>
              <button id="clearOfflineAppCacheButton" icon="clear"
                      label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"
                      oncommand="gAdvancedPane.clearOfflineAppCache();"/>
            </hbox>
            <label id="offlineAppsPermsLabel">&offlineAppsPermissions.label;</label>
            <hbox align="center">
              <menulist id="offlineAppsPerms-menu" preference="offline-apps.permissions" sizetopopup="always">
                <menupopup>
                  <menuitem label="&offlineAppsPermissions.Allow;"  value="2" />
                  <menuitem label="&offlineAppsPermissions.Ask;"    value="1" />
                  <menuitem label="&offlineAppsPermissions.Deny;"   value="0" />
                </menupopup>
              </menulist>
              <spacer flex="1"/>
              <button id="offlineNotifyExceptions"
                      label="&offlineNotifyExceptions.label;"
                      accesskey="&offlineNotifyExceptions.accesskey;"
                      oncommand="gAdvancedPane.showOfflineExceptions();"/>
            </hbox>
            <hbox>
              <vbox flex="1">
                <label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
                <listbox id="offlineAppsList"
                         style="height: &offlineAppsList.height;;"
                         flex="1"
                         aria-labelledby="offlineAppsListLabel"
                         onselect="gAdvancedPane.offlineAppSelected(event);">
                </listbox>
              </vbox>
              <vbox pack="end">
                <button id="offlineAppsListRemove"
                        disabled="true"
                        label="&offlineAppsListRemove.label;"
                        accesskey="&offlineAppsListRemove.accesskey;"
                        oncommand="gAdvancedPane.removeOfflineApp();"/>
              </vbox>
            </hbox>
          </groupbox>
        </tabpanel>

        <!-- Update -->
        <tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER
          <groupbox id="updateApp">
            <caption label="&updateApp.label;"/>
            <radiogroup id="updateRadioGroup"
                        oncommand="gAdvancedPane.updateWritePrefs();">
              <radio id="autoDesktop"
                     value="auto"
                     label="&updateAuto1.label;"
                     accesskey="&updateAuto1.accesskey;"/>
              <hbox class="indent">
                <checkbox id="warnIncompatible"
                          label="&updateAutoAddonWarn.label;"
                          accesskey="&updateAutoAddonWarn.accesskey;"
                          preference="app.update.mode"
                          onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
                          onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
              </hbox>
              <radio value="checkOnly"
                     label="&updateCheck.label;"
                     accesskey="&updateCheck.accesskey;"/>
              <radio value="manual"
                     label="&updateManual.label;"
                     accesskey="&updateManual.accesskey;"/>
            </radiogroup>

            <hbox>
              <button id="showUpdateHistory"
                      label="&updateHistory.label;"
                      accesskey="&updateHistory.accesskey;"
                      preference="app.update.disable_button.showUpdateHistory"
                      oncommand="gAdvancedPane.showUpdates();"/>
            </hbox>
          </groupbox>
#endif
          <groupbox id="updateOthers">
            <caption label="&updateOthers.label;"/>
            <checkbox id="enableSearchUpdate"
                      label="&enableSearchUpdate.label;"
                      accesskey="&enableSearchUpdate.accesskey;"
                      preference="browser.search.update"/>
          </groupbox>
        </tabpanel>

        <!-- Certificates -->
        <tabpanel id="encryptionPanel" orient="vertical">

            <!--
              The values on these radio buttons may look like l12y issues, but
              they're not - this preference uses *those strings* as its values.
              I KID YOU NOT.
            -->
            
            <groupbox>
                <caption label="&certGroup.label;"/>
                <description id="CertSelectionDesc" control="certSelection">&certSelection.description;</description>
                <radiogroup id="certSelection" orient="horizontal" preftype="string"
                            preference="security.default_personal_cert"
                            aria-labelledby="CertSelectionDesc">
                  <radio label="&certs.auto;" accesskey="&certs.auto.accesskey;"
                         value="Select Automatically"/>
                  <radio label="&certs.ask;" accesskey="&certs.ask.accesskey;"
                         value="Ask Every Time"/>
                </radiogroup>
            </groupbox>
            <groupbox>
                <caption label="&ocspGroup.label;"/>
                <checkbox id="enableOCSP"
                          label="&enableOCSP.label;"
                          accesskey="&enableOCSP.accesskey;"
                          onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
                          onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
                          preference="security.OCSP.enabled"/>
                <checkbox id="requireOCSP"
                          label="&requireOCSP.label;"
                          accesskey="&requireOCSP.accesskey;"
                          preference="security.OCSP.require"/>
            </groupbox>

            <separator/>

            <hbox>
                <button id="viewCertificatesButton"
                        label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
                        oncommand="gAdvancedPane.showCertificates();"
                        preference="security.disable_button.openCertManager"/>
                <button id="viewSecurityDevicesButton"
                        label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
                        oncommand="gAdvancedPane.showSecurityDevices();"
                        preference="security.disable_button.openDeviceManager"/>
            </hbox>
        </tabpanel>

        <!-- Pale Moon: Scrolling tab -->
        <tabpanel id="scrollparamTab" orient="vertical">

        <checkbox id="useSmoothScrolling"
                      label="&useSmoothScrolling.label;"
                      accesskey="&useSmoothScrolling.accesskey;"
                      preference="general.smoothScroll"/>
                      
        <label>&smoothscroll.explain.label;</label>
        
        <groupbox>
          <caption label="&smoothscroll.params.label;"/>
          
          <checkbox label="&smoothscroll.mousewheel.label;" preference="general.smoothScroll.mouseWheel"/>
          <hbox align="center" class="indent">
            <label value="&smoothscroll.mousewheel.duration;"/>
            <textbox type="number" size="3" max="500"
                     preference="general.smoothScroll.mouseWheel.durationMinMS"/>
            <label>&smoothscroll.to;</label>
            <textbox type="number" size="4" max="2000"
                     preference="general.smoothScroll.mouseWheel.durationMaxMS"/>
            <label flex="1">ms.</label>
          </hbox>
          
          <checkbox label="&smoothscroll.arrowkeys.label;" preference="general.smoothScroll.lines"/>
          <hbox align="center" class="indent">
            <label value="&smoothscroll.arrowkeys.duration;"/>
            <textbox type="number" size="3" max="500"
                     preference="general.smoothScroll.lines.durationMinMS"/>
            <label>&smoothscroll.to;</label>
            <textbox type="number" size="4" max="2000"
                     preference="general.smoothScroll.lines.durationMaxMS"/>
            <label flex="1">ms.</label>
          </hbox>
          
          <checkbox label="&smoothscroll.pagekeys.label;" preference="general.smoothScroll.pages"/>
          <hbox align="center" class="indent">
            <label value="&smoothscroll.pagekeys.duration;"/>
            <textbox type="number" size="3" max="500"
                     preference="general.smoothScroll.pages.durationMinMS"/>
            <label>&smoothscroll.to;</label>
            <textbox type="number" size="4" max="2000"
                     preference="general.smoothScroll.pages.durationMaxMS"/>
            <label flex="1">ms.</label>
          </hbox>
          
          <checkbox label="&smoothscroll.scrollbar.label;" preference="general.smoothScroll.scrollbars"/>
          <hbox align="center" class="indent">
            <label value="&smoothscroll.scrollbar.duration;"/>
            <textbox type="number" size="3" max="500"
                     preference="general.smoothScroll.scrollbars.durationMinMS"/>
            <label>&smoothscroll.to;</label>
            <textbox type="number" size="4" max="2000"
                     preference="general.smoothScroll.scrollbars.durationMaxMS"/>
            <label flex="1">ms.</label>
          </hbox>
          
          <hbox align="center">
            <label value="&smoothscroll.overall.yspeed.label;"/>
            <textbox type="number" size="3" min="1" max="999"
                     preference="mousewheel.default.delta_multiplier_y"/>
            <label flex="1">%.</label>
          </hbox>
        </groupbox>  
        </tabpanel>
        <!-- end Smooth scrolling tab -->
         
      </tabpanels>
    </tabbox>
  </prefpane>

</overlay>
